package com.slz3.business.module.messageManagement.mesLog.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.messageManagement.mesLog.domain.MesLog;
import com.slz3.business.module.messageManagement.mesLog.domain.MesLogFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class MesLogTransactionalServiceImpl implements MesLogTransactionalService {

    @Override
    public MesLog modify(MesLog mesLogNew) {
        Repositorys.mesLog.test();
        Repositorys.mesLog.save(MesLogFactory.initBaseFields());
        System.err.println(1 / 0);
        mesLogNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.mesLog.saveAndFlush(mesLogNew);
    }

    @Override
    public List<MesLog> batchModify(List<MesLog> mesLogList) {
        return Repositorys.mesLog.saveAll(mesLogList);
    }
}
